package com.boluo.web.controller.custom;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.boluo.custom.dto.CusInformationDTO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.boluo.common.annotation.Log;
import com.boluo.common.core.controller.BaseController;
import com.boluo.common.core.domain.AjaxResult;
import com.boluo.common.enums.BusinessType;
import com.boluo.custom.domain.CusInformation;
import com.boluo.custom.service.ICusInformationService;
import com.boluo.common.utils.poi.ExcelUtil;
import com.boluo.common.core.page.TableDataInfo;

/**
 * 项目一测试Controller
 * 
 * @author boluio
 * @date 2023-04-22
 */
@RestController
@RequestMapping("/custom/information")
public class CusInformationController extends BaseController
{
    @Autowired
    private ICusInformationService cusInformationService;

    /**
     * 查询项目一测试列表
     */
    @PreAuthorize("@ss.hasPermi('custom:information:list')")
    @GetMapping("/list")
    public TableDataInfo list(CusInformationDTO cusInformationDTO)
    {
        startPage();
        List<CusInformation> list = cusInformationService.selectCusInformationList(cusInformationDTO);
        return getDataTable(list);
    }



    /**
     * 获取项目一测试详细信息
     */
    @PreAuthorize("@ss.hasPermi('custom:information:query')")
    @GetMapping(value = "/{cusId}")
    public AjaxResult getInfo(@PathVariable("cusId") Long cusId)
    {
        return AjaxResult.success(cusInformationService.selectCusInformationByCusId(cusId));
    }

    /**
     * 新增项目一测试
     */
    @PreAuthorize("@ss.hasPermi('custom:information:add')")
    @Log(title = "项目一测试", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CusInformation cusInformation)
    {
        return toAjax(cusInformationService.insertCusInformation(cusInformation));
    }

    /**
     * 修改项目一测试
     */
    @PreAuthorize("@ss.hasPermi('custom:information:edit')")
    @Log(title = "项目一测试", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CusInformation cusInformation)
    {
        return toAjax(cusInformationService.updateCusInformation(cusInformation));
    }

    /**
     * 删除项目一测试
     */
    @PreAuthorize("@ss.hasPermi('custom:information:remove')")
    @Log(title = "项目一测试", businessType = BusinessType.DELETE)
	@DeleteMapping("/{cusIds}")
    public AjaxResult remove(@PathVariable Long[] cusIds)
    {
        return toAjax(cusInformationService.deleteCusInformationByCusIds(cusIds));
    }
}
